<?php
namespace lxs\config;

class BaseStatic
{

    protected static $instance;

    public function __construct()
    {
    }


    /**
     * 初始化服务
     * @return static
     */
    protected function initialize(): static
    {
        return $this;
    }


    /**
     * 静态实例对象
     * @param array $var 实例参数
     * @param boolean $new 创建新实例
     * @return static
     */
    public static function instance(array $var = [], bool $new = false): static
    {
        static::$instance = new static;
        return static::$instance;
    }


    /**
     * 服务返回
     * @param int $code
     * @param string $message
     * @param array|string|object $data
     * @return array
     */
    public static function serviceReturn(int $code, string $message, array|string|object $data = ''): array
    {
        $responseData = [
            'code'    => $code,
            'message' => $message,
        ];
        $responseData['data'] = $data;
        return $responseData;
    }



}
